<?php
class Zen_View_Helper_Video_Widget extends Zend_View_Helper_FormElement {
	
	const HEIGHT = 450;
	
	const WIDTH = 800;
	
	public function video_Widget($id,$params=array()) {
		if (! $id ) return ;
		$model = new Video_Model_Item();
		$res = $model->select()->getOne("id=$id");
		if (! $res) return ;
		if ($res['text']) return $res['text'];
		elseif ($res['path']) {
			$width = (isset($params['width'])) ? $params['width'] : self::WIDTH;
			$height = (isset($params['height'])) ? $params['height'] : self::HEIGHT;
			$view = new Zend_View();
			return "<iframe src='" . $view->url(array('id'=>$id),'video-frame') . "' width='$width' height='$height'></iframe>";
		} 
	}
	
}